
if( BUILD_SHARED_LIBS )
    add_definitions ( -DOPENSSL_BUILD_SHLIBSSL )
endif()

set ( LIBSRC s2_meth.c s2_srvr.c s2_clnt.c s2_lib.c s2_enc.c s2_pkt.c s3_meth.c s3_srvr.c
  s3_clnt.c s3_lib.c s3_enc.c s3_pkt.c s3_both.c s23_meth.c s23_srvr.c s23_clnt.c
  s23_lib.c s23_pkt.c t1_meth.c t1_srvr.c t1_clnt.c t1_lib.c t1_enc.c d1_meth.c d1_srvr.c
  d1_clnt.c d1_lib.c d1_pkt.c d1_both.c ssl_lib.c ssl_err2.c ssl_cert.c
  ssl_sess.c ssl_ciph.c ssl_stat.c ssl_rsa.c ssl_asn1.c ssl_txt.c ssl_algs.c bio_ssl.c
  ssl_err.c kssl.c t1_reneg.c tls_srp.c s3_cbc.c d1_srtp.c )
  
set(LIBH ssl.h ssl2.h ssl3.h ssl23.h tls1.h dtls1.h kssl.h srtp.h)

add_library ( commonLibOpenSSL ${LIBSRC} )

#设置预编译
SET_TARGET_PROPERTIES(commonLibOpenSSL PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "stdafx.h")
cotire(commonLibOpenSSL)

#设置目录
set_target_properties(commonLibOpenSSL PROPERTIES FOLDER "OpenSSL")

target_link_libraries ( commonLibOpenSSL commonLibOpenCrypto )

install( FILES ${LIBH}
    DESTINATION ${PROJECT_SOURCE_DIR}/3rdlib/include/openssl )

install( TARGETS commonLibOpenSSL
      RUNTIME DESTINATION ${PROJECT_BINARY_DIR}/bin
      LIBRARY DESTINATION ${PROJECT_SOURCE_DIR}/3rdlib/lib
      ARCHIVE DESTINATION ${PROJECT_SOURCE_DIR}/3rdlib/lib )